# -*- coding: utf-8 -*-
# @Time    : 2024/2/4 21:43
# @Author  : micah
# @File    : 20.selenium框架的自定义异常类.py
# @Software: PyCharm


from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait


browser = webdriver.Chrome()
# try:
#     raise TimeoutException
#     browser.get('https://www.google.com')
#
# except TimeoutException:
#     print('请求超时')
#     browser.quit()


try:
    browser.get('https://movie.douban.com')
    browser.find_element(By.ID, 'abc')
except NoSuchElementException:
    print('标签没找到')


